import translations from './translationsGerman';


export default function customTranslate(template: any, replacements: any) {
    replacements = replacements || {};

    // Translate
    template = translations[template] || template;

    // Replace
    return template.replace(/{([^}]+)}/g, function(_: any, key: any) {
        let str = replacements[key];
        if (translations[replacements[key]] != null && translations[replacements[key]] !== 'undefined') {
            str = translations[replacements[key]];
        }
        return str || '{' + key + '}';
    });
}
